﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<VERKProjectHopur16.Models.Content>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	All News
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>All News</h2>

    <div>
        <input type="button" onclick="document.location.href = '<%: Url.Action("CreateContent", new { id = 1 }) %>'" value="Add News" />
    </div>

    <div class="admincontentlist">
        <table>
            <thead>
                <tr>
                    <th><%= Html.ActionLink("Title", "OrderNews", new { id = 1 })%></th>
                    <th><%= Html.ActionLink("Date", "OrderNews", new { id = 2 })%></th>                    
                    <th><%= Html.ActionLink("Author", "OrderNews", new { id = 3 })%></th>
                    <th><%= Html.ActionLink("Department", "OrderNews", new { id = 4 })%></th>
                    <th></th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <% foreach (var item in Model) 
                { %>
                <tr>
                    <td><%: item.Title %></td>
                    <td><%: item.InsertDate.ToString("dddd, dd MMMM yyyy")%></td>  
                    <td><%: item.Author.Name %></td> 
                    <td><%: item.Department.Name %></td>           
                    <td><input type="button" onclick="document.location.href = '<%: Url.Action("EditContent", new { id = item.ContentID }) %>'" value="Edit" /></td>                 
                    <td><input type="button" onclick="document.location.href = '<%: Url.Action("RemoveContent", new { id = item.ContentID }) %>'" value="Delete" /></td>
                </tr>
                <% } %>
            </tbody>
        </table>
    </div>
</asp:Content>